using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Viettel.VOFFICE.DAO.Models.Mapping
{
    public class LibraryMap : EntityTypeConfiguration<Library>
    {
        public LibraryMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.AttachmentPath)
                .IsRequired()
                .HasMaxLength(256);

            this.Property(t => t.AttachmentName)
                .HasMaxLength(200);

            this.Property(t => t.Description)
                .HasMaxLength(500);

            this.Property(t => t.AttachmentDocPath)
                .HasMaxLength(256);

            this.Property(t => t.AttachmentPdfPath)
                .HasMaxLength(256);

            this.Property(t => t.AttachmentHtmlPath)
                .HasMaxLength(256);

            this.Property(t => t.AttachmentImagePath)
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("Library");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.AttachmentPath).HasColumnName("AttachmentPath");
            this.Property(t => t.AttachmentName).HasColumnName("AttachmentName");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.IsSubmission).HasColumnName("IsSubmission");
            this.Property(t => t.RelateToId).HasColumnName("RelateToId");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.CreatedAt).HasColumnName("CreatedAt");
            this.Property(t => t.UpdatedAt).HasColumnName("UpdatedAt");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.AttachmentDocPath).HasColumnName("AttachmentDocPath");
            this.Property(t => t.AttachmentPdfPath).HasColumnName("AttachmentPdfPath");
            this.Property(t => t.AttachmentHtmlPath).HasColumnName("AttachmentHtmlPath");
            this.Property(t => t.AttachmentImagePath).HasColumnName("AttachmentImagePath");
        }
    }
}
